import pandas as pd
import random

rng = list(pd.date_range('1/1/2017', periods=24, freq='M'))  # 生成日期
mony = [random.randint(1000, 9000) for i in range(0, 24)]  # 随机生成销售额
data = pd.DataFrame({'rng': rng, 'mony': mony})  # 组成一个dataframe

data['mony2'] = data['mony']
data['mony2'] = data['mony2'].shift(1)  # 纵向，向下位移
print(data)
